Dynomotion

Group: DynoMotion Message: 13240 From: stuntready Date: 5/7/2016
Subject: Closed Loop Spindle controll question

Hello Tom.


I am building lathe with Kflop+Kstep boards and I have some questions regarding spindle closed loop control setup.


Spindle motor is 220V DC motor. I have designed controller to drive this motor, and it works fine.


DC motor controller drives thyristor bridge, and voltage applied to motor varies depending triac phase firing angle. I have connected controller to Kflop step dir channel. Each 1/100 sec controller counts steps, calculates commanded velocity and transfer it to voltage applied to motor drive. Commanded velocity is proportional to output voltage. I had to use some math approximation cause of 8 bit controller, but velocity to voltage plot is almost linear with  2-3 % error and some S-curve behavior. 


Spindle sensor is 1000ppr optical encoder, max speed is 2000 rpm, so max velocity is 133 333 pps.


First of all if motor is not loaded I get max RPM at ~165 Vrms, also i have noticed that applied voltage is not directly proportional to RMP, actually not directly at all :) Also at low speeds spindle can be just stopped by hand (30 RPM).

I have to close the loop to operate at CCS and for threading.


So the questions is:


Can this setup operate in closed loop mode using KFLOP step dir chanel closed loop PID and filters? Or i should make come C program to drive my controller? Also is selected velocity control method is ok or I should change my controller software to be driven from PWM or something ?


Thx. in advance

B.R. Danchik







Group: DynoMotion Message: 13242 From: Tom Kerekes Date: 5/7/2016
Subject: Re: Closed Loop Spindle controll question

Hi BR,

I would think the simplest approach to try first would be to just operate as a Closed Loop Step/Dir Axis.  I would scale the encoder Input gain such that Jogging the at some Step Rate at about half speed, the encoder count rate is approximately the same rate (in open loop mode).

Allow infinite Max Output, large following error, and use some I gain.

In this case if the axis is told to Jog at some rate the Spindle should immediately move at approximately that rate.  If the spindle moves a bit slow then following error will accumulate until the Integrator Ramp rate increases to the level needed to stop the following error from growing further.  At that point the commanded Jog Rate and the actual Encoder Rate will be exactly equal.

HTH
Regards
TK





On 5/7/2016 4:55 AM, stuntready@... [DynoMotion] wrote:
 

Hello Tom.


I am building lathe with Kflop+Kstep boards and I have some questions regarding spindle closed loop control setup.


Spindle motor is 220V DC motor. I have designed controller to drive this motor, and it works fine.


DC motor controller drives thyristor bridge, and voltage applied to motor varies depending triac phase firing angle. I have connected controller to Kflop step dir channel. Each 1/100 sec controller counts steps, calculates commanded velocity and transfer it to voltage applied to motor drive. Commanded velocity is proportional to output voltage. I had to use some math approximation cause of 8 bit controller, but velocity to voltage plot is almost linear with  2-3 % error and some S-curve behavior. 


Spindle sensor is 1000ppr optical encoder, max speed is 2000 rpm, so max velocity is 133 333 pps.


First of all if motor is not loaded I get max RPM at ~165 Vrms, also i have noticed that applied voltage is not directly proportional to RMP, actually not directly at all :) Also at low speeds spindle can be just stopped by hand (30 RPM).

I have to close the loop to operate at CCS and for threading.


So the questions is:


Can this setup operate in closed loop mode using KFLOP step dir chanel closed loop PID and filters? Or i should make come C program to drive my controller? Also is selected velocity control method is ok or I should change my controller software to be driven from PWM or something ?


Thx. in advance

B.R. Danchik








Group: DynoMotion Message: 13263 From: stuntready Date: 5/11/2016
Subject: Re: Closed Loop Spindle controll question
Hi Tom, thank you very much for help.

I have scaled my system step rates. Contoller step rate is twice bigger than an axis chanel, and in open loop mode I get spindle max speed at a half of the maximum controler step rate.

If I close the loop and add some smal I-gain commanded jog rate and actual encoder rate is almost equal, but there is some overshooting, and still no torque at small RPM rates. Actualy it seems that I gain is so slow, and I need different I-gains for different RPM's ;)))

So, should I add some D-gain to stop overhooting, or PID filters ?
How should I deal with very slow I gain on low RPM rates ?

Thx. Danchik




Group: DynoMotion Message: 13264 From: Tom Kerekes Date: 5/11/2016
Subject: Re: Closed Loop Spindle controll question

Hi Danchik,

I don't understand the statement:

>>> I have scaled my system step rates. Contoller step

rate is twice bigger than an axis chanel, and in open loop mode I get spindle max speed at a half of the maximum controler step rate. Regards
TK


On 5/11/2016 4:45 AM, stuntready@... [DynoMotion] wrote:
 

Hi Tom, thank you very much for help.


I have scaled my system step rates. Contoller step rate is twice bigger than an axis chanel, and in open loop mode I get spindle max speed at a half of the maximum controler step rate.

If I close the loop and add some smal I-gain commanded jog rate and actual encoder rate is almost equal, but there is some overshooting, and still no torque at small RPM rates. Actualy it seems that I gain is so slow, and I need different I-gains for different RPM's ;)))

So, should I add some D-gain to stop overhooting, or PID filters ?
How should I deal with very slow I gain on low RPM rates ?

Thx. Danchik





Group: DynoMotion Message: 13266 From: stuntready Date: 5/12/2016
Subject: Re: Closed Loop Spindle controll question

Hello Tom.

 

Sorry for my bad explanation.

In my controller I have to transfer step pulses to output voltage, maximum voltage 220 v equals to  266  600 pps step rate. It is twice bigger then spindle max velocity which equals to 133 300 pps. So in open loop mode when kflop commands 133 300 pps velocity controller outputs 110 Vrms and real measured spindle velocity is about 100  000 pps.


Danchik

 

Group: DynoMotion Message: 13270 From: Tom Kerekes Date: 5/12/2016
Subject: Re: Closed Loop Spindle controll question

Hi Danchik,

I expected you to change the InputGain0 for the encoder so that the open loop step rate more closely matches the commanded step rate.

So for example with a gain of 2.0 then commanding 266600sps rate should then read the spindle at 266600sps rate.

However I see now that the open loop speed is so non-linear that this may not help much at other speeds.

I don't see why the commanded and actual rates wouldn't be exactly equal.  The response to changes might be terribly slow but eventually the speed should be correct.  Please post a plot with all your settings for a large move so we can see what is happening.

I think P Gain may help stabilize the response.

A different and possibly better approach might be to write the servo output to a Step/Dir Generator used as a frequency generator.  This would then work more like a traditional servo with a voltage amplifier.  This would require a User Program to write the Servo Output to the Frequency Generator.  See the C:\KMotion433\C Programs\StepAsPWM.c for an example of how to command a frequency.  See the C:\KMotion433\C Programs\OutputToPWM.c for an example of a loop to use the Servo Output for some custom purpose.

HTH
Regards
TK



On 5/12/2016 2:59 AM, stuntready@... [DynoMotion] wrote:
 

Hello Tom.

 

Sorry for my bad explanation.

In my controller I have to transfer step pulses to output voltage, maximum voltage 220 v equals to  266  600 pps step rate. It is twice bigger then spindle max velocity which equals to 133 300 pps. So in open loop mode when kflop commands 133 300 pps velocity controller outputs 110 Vrms and real measured spindle velocity is about 100  000 pps.


Danchik

 


Group: DynoMotion Message: 13272 From: stuntready Date: 5/13/2016
Subject: Re: Closed Loop Spindle controll question
Hi Tom, I have made some experiments,
As you noticed the open loop speed is extremly non linear. Actualy in this case Voltage to RPM plot is non linerar at all, but my controller step rate to output voltage transfer function is linear (almost). 
I have played with PID settings, and now I see that PID controll loop can't be stable at all speed range in my case. But in 1000 to 2000 rpm for example it can be stabilized so well, slow, but stable.
Also, cause of thyristor contoll, voltage can be updated only 100 times per seccond, after each AC zero cross. So I think some C program is realy beter approach as well.

Thx for help, i will try and post results.

Danchik
Group: DynoMotion Message: 13291 From: stuntready Date: 5/22/2016
Subject: Re: Closed Loop Spindle controll question
Hi Tom,

I made a user program. Writing Servo Output from spindle encoder channel to step/dir Frequency Generator works fine. With only P gain spindle response on low speed is significantly better. I have some questions regarding tuning the loop:

Should I use PD-control  or  only I-control in the servo loop in my case?
How can I increase loop response in low speeds, will feed/forward control help ?
Should I use any IIR filters in my setup ?

Thx for help, Danchik.
Group: DynoMotion Message: 13293 From: TKSOFT Date: 5/22/2016
Subject: Re: Closed Loop Spindle controll question
Hi Danchik,

You will probably never have great loop response if your output control
is slow. Its like trying to tell a drunk driver of a car how to drive
well.

I think you shouldn't need any I Gain because you only need to go at the
right speed and don't care if you are lagging behind in position. I
Gain tends to destabilize the system so only use it if needed.

Try P and D gains. D gains may produce short spikes in the Output that
your slow output stage may ignore so use a 2nd order low pass filter to
smooth out and widen the spikes. Use the last IIR Filter so it applies
to FF as well. Try low frequencies such as 100-200 Hz Q=1.4. This
should allow higher D gain and then Higher P gain.

FF may help but use only as a last resort as it is open loop and changes
in load will not be corrected.

HTH
Regards
TK


On 2016-05-22 05:42, stuntready@... [DynoMotion] wrote:
> Hi Tom,
>
> I made a user program. Writing Servo Output from spindle encoder
> channel to step/dir Frequency Generator works fine. With only P gain
> spindle response on low speed is significantly better. I have some
> questions regarding tuning the loop:
>
> Should I use PD-control or only I-control in the servo loop in my
> case?
> How can I increase loop response in low speeds, will feed/forward
> control help ?
> Should I use any IIR filters in my setup ?
>
> Thx for help, Danchik.